import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param s string字符串 
     * @return int整型
     */

    public static void main(String[] args) {
       String s="asdaa";
        Solution kk=new Solution();
        System.out.println(kk.lengthOfLongestSubstring(s));
    }

    public int lengthOfLongestSubstring (String s) {
        // write code here
        StringBuffer sss=new StringBuffer(s.charAt(0));
      int max=1,num=1;
        for(int i=1;i<s.length();i++) {
            num=1;
            if(!sss.toString().contains(new StringBuffer(s.charAt(i))))
                    { sss.append(s.charAt(i));num++;}
            if(sss.toString().contains(new StringBuffer(s.charAt(i))))
                    
            if(num>max) max=num;
        }
   return max;
    }
}